<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}"/>
<head th:include="fragments/head::header"/>
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">

            <div class="page-content">

                <h3 class="header smaller lighter blue">添加审批流程</h3>
                <div id="ulId" class=""></div>
                <br/>

                <form method="post" id="addWorkFlowNodeInfo">
                    <input type="hidden" th:value="${flowId}" name="flowId"/>
                    <div class="tab-pane fade in active">
                        <div class="container">
                            <div class="form-horizontal">
                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue">用户组：</label>
                                    <select name="userGroup" id="userGroup">
                                        <option value="">--请选择用户组--</option>
                                        <option th:each="item: ${uGroup}" th:value="${item.id}"
                                                th:text="${item.groupName}"
                                                th:selected="${workflowInfo.userGroup == item.id}"
                                                disabled="disabled"></option>
                                    </select>


                                </div>

                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue">流程：</label>
                                    <select name="caseId" id="caseId">
                                        <option value="">--请选择流程--</option>
                                        <option th:each="item: ${caseList}" th:value="${item.code}"
                                                th:text="${item.name}" th:selected="${workflowInfo.caseId == item.code}"
                                                disabled="disabled"></option>
                                    </select>
                                </div>


                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue">当前组成员：</label>
                                    <select name="oaId" id="caseId">
                                        <option value="">--请选择审批人--</option>
                                        <option th:each="item: ${ulist}" th:value="${item.oaId}"
                                                th:text="${item.userName}"></option>
                                    </select>
                                </div>

                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue">请输入审批顺序：</label>
                                    <input name="auditSequence" onkeyup="this.value=this.value.replace(/\D/g,'')"
                                           maxlength="1"/>
                                </div>

                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue">是否是最终审批人：</label>
                                    <input type="radio" name="lastStatus" value="1"/>是&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="radio" name="lastStatus" value="0"/>否
                                </div>

                            </div>
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" id="addWorkFlow">保存</button>
                        <button type="button" class="btn btn-primary" onclick="window.history.back(-1); ">返回</button>
                    </div>

                    <div id="alert" class="alert alert-success" style="display: none;" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <span id="alertText"></span>
                    </div>
                </form>

            </div>
        </div>
        <div th:include="fragments/bottom::bottom"></div>
    </div>

    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

        </div>
    </div>
</div>


<div th:include="fragments/js::js"></div>


<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script type="text/javascript" th:src="@{/ztree/js/jquery.ztree.core-3.5.min.js}"></script>
<script type="text/javascript" th:src="@{/ztree/js/jquery.ztree.excheck-3.5.min.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/bootstrap/js/star-rating.min.js}"></script>
<script th:src="@{/business/role/add.js}"></script>
<!--ueditor-->
<script type="text/javascript" charset="utf-8" th:src="@{/UEditor/ueditor.config.js}"></script>
<script type="text/javascript" charset="utf-8" th:src="@{/UEditor/ueditor.all.min.js}"></script>
<script type="text/javascript" charset="utf-8" th:src="@{/UEditor/lang/zh-cn/zh-cn.js}"></script>
<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
</body>
</html>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    var flowId = [[${flowId}]];
    $(function () {

        $("#addWorkFlow").click(function () {

            $("#addWorkFlow").attr("disabled", "disabled");
            $.ajax({
                url: "/workflow/addWorkFlowNodeInfo",
                type: "post",
                data: $("#addWorkFlowNodeInfo").serialize(),
                success: function (data) {
                    if (!data) {
                        layer.msg("此用户组的该场景已存在！", {
                            icon: 2
                        })
                    } else {
                        window.history.back(-1);
                    }

                }
            })

        });
    });

    /*]]>*/
</script>